VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "CMouseWheel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private mWnd As Window      ' Window whose mouse wheel messages we are going to track
Implements IsgMessageSink   ' Message sink

Public Property Let HWND(wnd As Long)
    On Error GoTo Error_
    
    If mWnd Is Nothing Then
        Set mWnd = New Window
    Else
        ' Disable all messages
        mWnd.EnableMessage wm_ALL, False
    End If
    
    mWnd.HWND = wnd
    mWnd.EnableMessage wm_MOUSEWHEEL
    mWnd.Callback = Me
    mWnd.Hooked = True

    
    Exit Property
Error_:
    MsgBox Error$
End Property

Public Property Get HWND() As Long
    HWND = mWnd.HWND
End Property


Private Sub IsgMessageSink_Message(ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long, ByRef result As Long)
    Dim s$
    s = "Message: " + CStr(msg) + ", " + CStr(wParam) + ", " + CStr(lParam)
    MsgBox s
   
End Sub
